package cn.com.dingtek.genius.manager.server.service;

import cn.com.dingtek.genius.manager.server.support.*;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class SupportService {
    public List<JSONObject> deviceType() {
        return Arrays.stream(DeviceType.values())
                .map(item -> new JSONObject().fluentPut("code", item.getValue()).fluentPut("label", item.getDesc()))
                .collect(Collectors.toList());
    }

    public List<JSONObject> deviceSocket() {
        return Arrays.stream(DeviceSocket.values())
                .map(item -> new JSONObject().fluentPut("code", item.getValue()).fluentPut("label", item.getDesc()))
                .collect(Collectors.toList());
    }

    public List<JSONObject> platformType() {
        return Arrays.stream(PlatformType.values())
                .map(item -> new JSONObject().fluentPut("code", item.getValue()).fluentPut("label", item.getDesc()))
                .collect(Collectors.toList());
    }

    public List<JSONObject> toWebType() {
        return Arrays.stream(ToWebType.values())
                .map(item -> new JSONObject().fluentPut("code", item.getValue()).fluentPut("label", item.getDesc()))
                .collect(Collectors.toList());
    }

    public List<JSONObject> staffAppType() {
        return Arrays.stream(StaffAppType.values())
                .map(item -> new JSONObject().fluentPut("code", item.getValue()).fluentPut("label", item.getDesc()))
                .collect(Collectors.toList());
    }
}
